#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int n = 0;
	int i = 0;
	int max = 0, min = 10001;
	scanf("%d", &n);
	int number = 0;
	for (i = 1; i <= n; i++)
	{
		scanf("%d", &number);
		if (number > max)
		{
			max = number;
		}
		if (number <= min)
		{
			min = number;
		}
	}
	printf("%d", max - min);
	return 0;
}
